#!/bin/bash
#
# Open a port on the specified machine for incoming traffic
#

RET=0
echo "================================================================="
echo "open_port.bash: begin"

source common-func.bash > /dev/null 2>&1
if [ $? -gt 0 ]; then
    echo "Error: This script requires common-func.bash"
    exit 1
fi

if [ ! $# -eq 1 ]; then
    echo "Error: Expecting a port as an argument"
    exit 1
fi

isRoot

PORT=$1
open_port $PORT
RET=$?
if [ ! $RET -eq 0 ];
then
    echo "Encountered error during open_port ($RET)"
    pause '> Press [ENTER] to continue or [CTRL-C] to exit'
fi

echo "open_port.bash: done ($RET)"
echo "================================================================="
exit $RET
